package gunfire.relics;

import basemod.abstracts.CustomRelic;
import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.relics.AbstractRelic;
import gunfire.GunfireMod;
import gunfire.util.TextureLoader;

import static gunfire.GunfireMod.makeRelicOutlinePath;
import static gunfire.GunfireMod.makeRelicPath;

public class StartupFund extends CustomRelic {

    public static final String ID = GunfireMod.makeID("StartupFund");
    private static final Texture IMG = TextureLoader.getTexture(makeRelicPath("StartupFund.png"));
    private static final Texture OUTLINE = TextureLoader.getTexture(makeRelicOutlinePath("blank.png"));
    private int turn;

    public StartupFund() {
        super(ID, IMG, OUTLINE, RelicTier.STARTER, LandingSound.CLINK);
        this.turn = 1;
    }

    @Override
    public void atPreBattle() {
        this.turn = 1;
    }

    @Override
    public void atTurnStart() {
        if(this.turn == 1){
            this.flash();
            this.addToBot(new DrawCardAction(1));
            this.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this));
        } else if(this.turn == 2){
            this.flash();
            this.addToBot(new GainEnergyAction(1));
            this.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this));
        }
        this.turn++;
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }

    @Override
    public AbstractRelic makeCopy() {
        return new StartupFund();
    }
}
